<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/plugins/pace-0.7.5/pace.js"></script>
    <link href="/plugins/pace-0.7.5/themes/blue/pace-theme-flash.css" rel="stylesheet" />
    <!-- Bootstrap -->
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <!-- bootstrapValidator -->
    <link rel="stylesheet" href="/plugins/bootstrap-validator/css/bootstrapValidator.min.css">
    <!-- Lobibox -->
    <link rel="stylesheet" href="/plugins/lobibox/css/lobibox.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="/css/AdminLTE.min.css">
    <!-- animate -->
    <link rel="stylesheet" href="/plugins/animate/animate.css">
    <style>
        body {
            background: #ecf0f5;
        }
        .login-box {
            width: 360px;
            margin: auto;
            padding-top: 100px;
        }
        @media (max-width: 768px) {
            .login-box {
                width: 90%;
            }
        }
        .login-logo a {
            font-size: 30px;
            text-decoration: none;
            color: #666;
        }
        .login-body {
            width: 100%;
            margin-top: 30px;
            padding: 15px;
            background: #fff;
        }
        .code-group {
            display: flex;
        }
        #code {
            max-width: 160px;
        }

        #code-img {
            margin-left: 12px;
        }
        .code-group small {
            position: absolute;
            display: flex;
            margin-top: 33px;
        }
        #login-form > button {
            margin-top: 25px;
        }
    </style>
</head>
<body>

<div class="login-box animated bounce">
    <div class="login-logo">
        <a href="#"><b>xiangmu</b></a>
    </div>
    <div class="login-body">
        <form id="login-form" action="" method="post">
            <div class="form-group has-feedback">
                <input type="text" class="form-control"  name="username" placeholder="username" autocomplete="off">
                <span class="glyphicon glyphicon-user form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <input type="password" class="form-control" name="password" placeholder="password" autocomplete="off">
                <span class="glyphicon glyphicon-user form-control-feedback"></span>
            </div>
            <button type="submit" class="btn btn-success btn-block btn-flat">login</button>

        </form>

    </div>
    <span><a href="/admin/register.html">register</a></span>
</div>

<script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<script src="/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="/plugins/jQueryForm/jquery.form.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="/js/bootstrap.min.js"></script>
<script src="/plugins/lobibox/js/lobibox.min.js"></script>
<!-- bootstrapValidator -->
<script src="/plugins/bootstrap-validator/js/bootstrapValidator.min.js"></script>
<script src="/js/common.js"></script>

<script>
    function successFn(data) {
        window.location="/user/index.html";
    }
    function errorFn(data) {
        window.location="/user/index.html";
    }
    $(document).ready(function() {
        $('#login-form').bootstrapValidator({
            fields: {
                username: {
                    validators: {
                        notEmpty: {
                            message: '请输入账号'
                        }
                    }
                },
                password: {
                    validators: {
                        notEmpty: {
                            message: '请输入密码'
                        }
                    }
                },
            }
        }).on('success.form.bv', function(e) {
            e.preventDefault();
            ajaxSubmitForm("/user/login", $(this).serialize(), successFn ,errorFn);
        });
    });

</script>
</body>
</html>